package com.beauty.dressing.module.market.activity;

import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseActivity;
import com.beauty.dressing.common.bean.LeaseReadyPayResultBean;
import com.beauty.dressing.common.bean.User;
import com.beauty.dressing.logic.control.LBController;
import com.beauty.dressing.module.market.presenter.PayPresenter;
import com.beauty.dressing.module.market.presenter.contract.PayContract;

public class MethodPaymenteActivity extends BaseActivity {
    TextView tv_determine;
    LinearLayout wechat_ll, zfb_ll;
    CheckBox zfb_ivbtn, wechat_ivbtn;

    @Override
    public void setContentView() {
        setContentView(R.layout.activity_method_paymente);
    }

    @Override
    public void findView() {
        tv_determine = findViewById(R.id.tv_determine);
        wechat_ll = findViewById(R.id.wechat_ll);
        zfb_ll = findViewById(R.id.zfb_ll);
        zfb_ivbtn = findViewById(R.id.zfb_ivbtn);
        wechat_ivbtn = findViewById(R.id.wechat_ivbtn);
        zfb_ll.setOnClickListener(this);
        tv_determine.setOnClickListener(this);
        wechat_ll.setOnClickListener(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.wechat_ll:
                wechat_ivbtn.setChecked(true);
                zfb_ivbtn.setChecked(false);
                break;
            case R.id.zfb_ll:
                wechat_ivbtn.setChecked(false);
                zfb_ivbtn.setChecked(true);
                break;
            case R.id.tv_determine:
                User user = LBController.getInstance().getCacheManager().getLoginUser();
                LeaseReadyPayResultBean bean = (LeaseReadyPayResultBean) getIntent().getSerializableExtra("data");
                payPresenter.createAlipay(1, bean.getId());
                break;
        }
    }

    PayPresenter payPresenter = new PayPresenter(new PayContract.ViewControl() {
        @Override
        public void onCreateWxpay(boolean isSuccess, int code, String message, Object data) {

        }

        @Override
        public void onCreateAlipay(boolean isSuccess, int code, String message, Object data) {
            if (isSuccess) {
                Log.e(TAG, message);
            }
        }
    });
}

